<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="lib/axios.js"></script>
  </head>
  <body>
    <button id="btn2">发起POST请求</button>
    <script>
      document.querySelector("#btn2").addEventListener("click", function () {
        // 请求的url地址  
        let url = "http:www.liulongbin.top:3006/api/post";
        // 请求的参数对象
        let dataObj = { address: "北京", location: "顺义" };
        // 调用axios.get()发起GET请求
        axios.post(url, dataObj).then(function (res) {
          // res.data 是服务器返回的数据
          console.log(res.data);
        });
      });
    </script>
  </body>
</html>
